<template>
	<view class="page-box">
		<view class="row-box" style="font-size: 36rpx;font-weight: 900;margin-top: 30rpx;">
			<text>{{roleInfo.recoveryName}}</text>
		</view>
		<view class="time-box row-box">
			<view class="drop-box"></view>
			<view>
				<text>{{new Date().getDate() + "/"}}</text>
				{{getTimeStr()}}
			</view>
		</view>
		
		<view  class="row-box" style="margin-top: 20rpx;">
			<view class="money_box">
				<view>今日成交额</view>
				<view  class="price_text">{{dataInfo.successAmount ? dataInfo.successAmount : 0}}</view>
			</view>
			
			<view  style="margin-left: 30rpx;width: 45%;">
				<view class="order-box row-box">
					<view  class="number-box">
						<view class="price_text">{{dataInfo.inquiryCount}}</view>
						<view>询单量</view>
					</view>
					<view class="number-box">
						<view class="price_text">{{dataInfo.offerCount}}</view>
						<view>报单量</view>
					</view>
					<view  style="margin-left: 15rpx;margin-top: 10rpx;">
						<u-image width="60rpx" height="60rpx" :src="orderIcon"></u-image>
					</view>
				</view>
				
				<view  class="row-box">
					<view class="jy-box">
						<view style="font-weight: 900;font-size: 32rpx;">{{dataInfo.successCount}}</view>
						<view style="font-size: 28rpx;">达成交易</view>
					</view>
					<view class="jy-box">
						<view style="font-weight: 900;font-size: 32rpx;">{{dataInfo.successRate}}%</view>
						<view style="font-size: 28rpx;">成交率</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="order-line">
			<view class="h2-font">订单跟踪</view>
			<view class="row-box" style="margin-top: 30rpx;">
				<view  v-for="it in orderList" class="item-box" @click="gotoOrderList(it.type)">
					<view>
						<view class="badge-box">
							<u-badge max="99" :value="it.number"></u-badge>
						</view>
						<image class="icon_img" :src="it.url"></image>
						<view>{{it.text}}</view>
					</view>
				</view>
				
			</view>
		</view>
		
		<view class="order-line">
			<view class="h2-font">我的权限</view>
			<view class="row-box">
				<view class="menus_box">
					<view class="center-box">
						<view class="img-box center-box orange-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/he_zuo.png')"></image>
						</view>
					</view>
					<view>合作商户</view>
				</view>
				<view class="menus_box" @click="gotoOfferList">
					<view class="center-box">
						<view class="img-box center-box blue-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/bjs.png')"></image>
						</view>
					</view>
					<view>报价师</view>
				</view>
				<view class="menus_box">
					<view class="center-box">
						<view class="img-box center-box purple-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/renli.png')"></image>
						</view>
					</view>
					<view>项目成员</view>
				</view>
				<view class="menus_box" @click="gotoAddress()">
					<view class="center-box">
						<view class="img-box center-box light-blue-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/addr.png')"></image>
						</view>
					</view>
					<view>收货地址</view>
				</view>
			</view>
			
			<!-- <view class="row-box">
				<view class="menus_box">
					<view class="center-box">
						<view class="img-box center-box yellow-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/red_bao.png')"></image>
						</view>
					</view>
					<view>红包活动</view>
				</view>
				<view class="menus_box">
					<view class="center-box">
						<view class="img-box center-box red-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/sel_order.png')"></image>
						</view>
					</view>
					<view>查询订单</view>
				</view>
				<view class="menus_box">
					<view class="center-box">
						<view class="img-box center-box dark-blue-bg-shadow">
							<image class="icon_img_mini" :src="require('@/static/img/quan_xian/export.png')"></image>
						</view>
					</view>
					<view>订单导出</view>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {getMonthAndDay} from "@/utils/dateUtils.js"
	export default {
		data() {
			return {
				roleInfo: null,
				show: false,
				dataInfo: {
					successAmount: 0, 	//成交额
					inquiryCount: 0,	//询单量
					offerCount: 0,	//报单量
					successCount: 0,	//报单量
					successRate: 0,	//成交率
					waitOfferCount: 0,	//待报价数量
					alreadyOfferCount: 0,	//已报价数量
					waitReceivingCount: 0,	//待收货数量
					alreadyRefundCount: 0,	//已退单数量
					noSuccessCount: 0,	//未成交数量
				},
				orderIcon: require("@/static/img/order.png"),
				/* 订单步骤 */
				orderList: [
					{
						text: "待报价",
						url: require("@/static/img/order/db.png"),
						number: 0,
						type: 1
					},
					{
						text: "已报价",
						url: require("@/static/img/order/yb.png"),
						number: 0,
						type: 2
					},
					{
						text: "待收货",
						url: require("@/static/img/order/dsh.png"),
						number: 0,
						type: 3
					},
					{
						text: "已退单",
						url: require("@/static/img/order/bh.png"),
						number: 0,
						type: 4
					},
					{
						text: "未成交",
						url: require("@/static/img/order/yc.png"),
						number: 0,
						type: 5
					}
				]
			}
		},
		created() {
			this.getRoleInfo();
			this.getData();
		},
		methods: {
			gotoAddress() {
				uni.navigateTo({
					url: "/pages/admin/address/address"
				})
			},
			gotoOrderList(e) {
				uni.navigateTo({
					url: "/pages/public/order-list?type=" + e
				})
			},
			// 统计数据
			getData() {
				this.$request("/appRecoverApi/order/queryRecycleStatistic", "get").then(res => {
					this.dataInfo = res.data;
					this.orderList[0].number = this.dataInfo.waitOfferCount;
					this.orderList[1].number = this.dataInfo.alreadyOfferCount;
					this.orderList[2].number = this.dataInfo.waitReceivingCount;
					this.orderList[3].number = this.dataInfo.alreadyRefundCount;
					this.orderList[4].number = this.dataInfo.noSuccessCount;
				})
			},
			// 前往报价师列表
			gotoOfferList() {
				uni.navigateTo({
					url: "/pages/quoter/offer-list"
				})
			},
			/* 获取时间字符串 */
			getTimeStr() {
				return getMonthAndDay();
			},
			/* 获取角色信息 */
			getRoleInfo() {
				uni.getStorage({
					key: this.$constant.ROLE_INFO_KEY,
					success: (res) => {
						this.roleInfo = res.data
						console.log(this.roleInfo)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-box {
		background-image: linear-gradient(45deg,#f2f8fc 48%, #dff4fb, #f2f6ec);
		padding: 28rpx;
		height: 100vh;
	}
	.time-box {
		margin-top: 40rpx;
		font-size: 36rppx;
		padding: 20rpx 0;
		color: #3F536E;
		text {
			font-size: 46rpx;
			font-weight: 900;
		}
	}
	.drop-box {
		background-color: $uni-color-warning;
		width: 18rpx;
		height: 18rpx;
		border-radius: 50%;
		margin-top: 20rpx;
		margin-right: 20rpx;
	}
	.money_box {
		background-image: linear-gradient(#dbf1e1, #fff);
		width: 45%;
		padding: 30rpx;
		height: 200rpx;
		border-radius: 15rpx;
		font-size: 30rpx;
		line-height: 60rpx;
		.price_text  {
			font-size: 46rpx;
			font-weight: 900;
		}
	}
	.order-box {
		background-image: linear-gradient(#fab6b6,  #fff);
		width: 85%;
		padding: 20rpx;
		border-radius: 15rpx;
		color: #dd6161;
		.number-box {
			width: 35%;
			font-size: 22rpx;
		}
		.price_text  {
			font-size: 40rpx;
			font-weight: 900;
		}
	}
	.jy-box {
		background-color: #fff;
		padding: 20rpx 16rpx;
		width: 120rpx;
		margin: 16rpx  10rpx 0 0;
		border-radius: 10rpx;
	}
	.order-line{
		background-color: #fff;
		margin-top: 30rpx;
		padding: 20rpx;
		border-radius: 10rpx;
	}
	.item-box {
		width: 22%;
		text-align: center;
		font-size: 24rpx;
	}
	.badge-box {
		position: absolute;
		margin-left: 80rpx;
		margin-top: -5rpx;
	}
	.menus_box{
		width: 25%;
		text-align: center;
		font-size: 26rpx;
		line-height: 58rpx;
		margin-top: 40rpx;
	}
</style>
